home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / editor / iff2clip.rexx < prev    next >
OS/2 REXX Batch file  |  1995-12-22  |  7KB  |  213 lines

  1. /* Iff2Clip.rexx V3.0 - Turns A Series of RGB files into a clip */
  2. /* By Bob Caron (Grue) ©1995 NewTek Inc.                        */
  3.  
  4. call remlib('ToasterARexx.port')
  5. call remlib('PROJECT_REXX_PORT')
  6.  
  7. call addlib('PROJECT_REXX_PORT' , 0)
  8. call addlib('ToasterARexx.port' , 0)
  9.  
  10. call set_view(2)
  11. call req_error("IFF2Clip V3.0     ---    Create a Flyer clip out of a sequence of IFF image files.")
  12. name=reqit("Select first frame of sequence?","Toaster:Images","BaseName")
  13. IFFBaseName=name
  14.  
  15. file=reqit("Save Clip Where?","Fa0:","ClipName")
  16.  
  17. if exists(file) then
  18.    if req_tell("Ok to append to that clip?")=0 then call quit
  19.  
  20. if lastpos('/',file,length(file)-1)~=0 then do
  21.    filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  22.    path=left(file,(lastpos('/',file,length(file))-1))
  23.    end
  24. else do
  25.    filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  26.    path=left(file,(lastpos(':',file,length(file))))
  27.    end
  28.  
  29. call pragma("D",path)
  30. path=pragma("D","RAM:")
  31.  
  32. name=path||filenam
  33.  
  34. startframe=req_number("Starting Frame #",1)
  35. if startframe="CANCEL" then call quit()
  36. endframe=req_number("Ending Frame #",100)
  37. if endframe="CANCEL" then call quit()
  38. ext=getext(IFFBaseName)
  39. if upper(right(IFFBaseName,4))=ext then IFFBaseName=left(IFFBaseName,length(IFFBaseName)-4)
  40. len=3
  41. if length(endframe)=4 then len=4
  42. do i=1 to len
  43.   if right(iffbasename,1)>="0" & right(iffbasename,1)<="9" then
  44.      iffbasename=left(IFFBaseName,length(IFFBaseName)-1)
  45. end
  46. combo=0
  47. if exists(IFFBaseName||Overlay(startframe,'000',4-Length(startframe))) then combo=1
  48. if exists(IFFBaseName||Overlay(startframe,'000',4-Length(startframe))||ext) then combo=2
  49. if exists(IFFBaseName||Overlay(startframe,'0000',5-Length(startframe))) then combo=3
  50. if exists(IFFBaseName||Overlay(startframe,'0000',5-Length(startframe))||ext) then combo=4
  51.  
  52. if combo=0 then do
  53.  req_tell("Error!","I can't find those files!")
  54.  call quit
  55.  end
  56.  
  57. call req_error("Note: HQ-5 selection will only work if HQ-5 is turned on in the options panel.")
  58. compression=-1
  59. buttons='000'
  60. do while compression=-1
  61.   buttons=req_buttons("Choose Compression:",buttons,"HQ-5","Standard","Extended")
  62.   if buttons="CANCEL" then call quit
  63.  
  64.   if buttons="100" then do
  65.      compression=3
  66.      end
  67.   if buttons="010" then do
  68.      compression=0
  69.      end
  70.   if buttons="001" then do
  71.      compression=1
  72.      end
  73. end
  74.  
  75. call req_error("")
  76.  
  77. if req_tell("Click 'Continue' to begin.")=0 then call quit
  78.  
  79. if ~exists("toaster:programs/flyer_support/c/setplaymode") then do
  80.    call req_tell("Error:","I am missing the program","'SetPlayMode' in your","Programs/Flyer_Support/c directory")
  81.    call quit()
  82.    end
  83. if ~exists("toaster:programs/flyer_support/c/AppendFields") then do
  84.    call req_tell("Error:","I am missing the program","'AppendFields' in your","Programs/Flyer_Support/c directory")
  85.    call quit()
  86.    end
  87.  
  88. Switcher(MDV1)
  89. Switcher(PDV1)
  90. error=""
  91. step=1
  92. if startframe>endframe then step=-1
  93. noframe=0
  94. do i = StartFrame to EndFrame by step
  95.        if combo=1 then filename=IFFBaseName||Overlay(i,'000',4-Length(i))
  96.        if combo=2 then filename=IFFBaseName||Overlay(i,'000',4-Length(i))||ext
  97.        if combo=3 then filename=IFFBaseName||Overlay(i,'0000',5-Length(i))
  98.        if combo=4 then filename=IFFBaseName||Overlay(i,'0000',5-Length(i))||ext
  99.        if ~exists(filename) then noframe=noframe+1
  100. end
  101.  
  102. if noframe>0 then
  103.    if ~req_tell("Notice:","There are "||noframe||" missing frames","Should I continue?") then call quit
  104. address command "toaster:programs/flyer_support/c/setplaymode 0 REC"
  105. do i = StartFrame to EndFrame by step
  106.        if combo=1 then filename=IFFBaseName||Overlay(i,'000',4-Length(i))
  107.        if combo=2 then filename=IFFBaseName||Overlay(i,'000',4-Length(i))||ext
  108.        if combo=3 then filename=IFFBaseName||Overlay(i,'0000',5-Length(i))
  109.        if combo=4 then filename=IFFBaseName||Overlay(i,'0000',5-Length(i))||ext)
  110.        call req_error("IFF2Clip V3.0  -  Current Frame:"||i||"   Frames to Go:"||endframe-i||"   "||error)
  111.        if exists(filename) then do
  112.           call req_close()
  113.           call req_open("Loading Image... Please wait.")
  114.           Switcher(LRGB,value("filename"),0)
  115.           name.temp='"'||name||'"'
  116.           address command "toaster:programs/flyer_support/c/appendfields "||name.temp||" 2 "compression" >env:output"
  117.           call checkfull()
  118.           end
  119.        else
  120.           error="(Error:Missing Frame "||i||"!)"
  121.        end
  122. call req_close()
  123. address command "toaster:programs/flyer_support/c/setplaymode 0 PLAY"
  124. icontime=REQ_FLYERJOG("Choose frame for icon.",name,1)
  125. if icontime="CANCEL" then call quit
  126. icontime=icontime*2
  127. call MAKEICON(name,icontime)
  128. call req_close()
  129. call req_error("")
  130. call req_error("All done.")
  131. call remlib('PROJECT_REXX_PORT')
  132. call remlib('ToasterARexx.port')
  133. exit
  134.  
  135. quit:
  136.    call req_close()
  137.    call req_error("Canceled.")
  138.    call remlib('ToasterARexx.port')
  139.    call remlib('PROJECT_REXX_PORT')
  140.    exit
  141.  
  142.  
  143. Reqit:
  144. parse arg title,location,filename
  145.  
  146. if ~exists('c:reqit') then do
  147.   call req_tell("Error!","This script requires the","program 'reqit' in C:")
  148.   call quit
  149.   end
  150.  
  151. Switcher(TOWB)
  152.  
  153. Title='"'||Title||'"'
  154.  
  155. address command "c:reqit "||Title||" "||location||" "||filename
  156.  
  157. inline='0'
  158.  
  159. if (~open(state, 'env:reqout', 'R')) then do
  160.   Switcher(TOSW)
  161.   call req_tell("Error with ReqIt! #15")
  162.   call close state
  163.   call quit
  164. end
  165.  
  166. inline=readln(state)
  167. call close state
  168.  
  169. Switcher(TOSW)
  170.  
  171. if inline="" then inline="0"
  172. if inline=0 then call quit
  173.  
  174. return inline
  175.  
  176. checkfull:
  177. open(state, "env:output", R)
  178. null=readln(state)
  179. if left(readln(state),8)="Error 33" then do
  180.    address command "toaster:programs/flyer_support/c/setplaymode 0 PLAY"
  181.    call req_close()
  182.    call req_tell("Error:","        Your flyer drive is Full!")
  183.    call quit()
  184.    end
  185. call close state
  186. return
  187.  
  188. getext: procedure
  189. parse arg IFFBaseName
  190.  
  191. ext=".IFF"
  192. if upper(right(IFFBaseName,4))=".ALS" then ext=".ALS"
  193. if upper(right(IFFBaseName,4))=".BMP" then ext=".BMP"
  194. if upper(right(IFFBaseName,4))=".CIN" then ext=".CIN"
  195. if upper(right(IFFBaseName,4))=".IFF" then ext=".IFF"
  196. if upper(right(IFFBaseName,4))=".JPG" then ext=".JPG"
  197. if upper(right(IFFBaseName,4))=".PCX" then ext=".PCX"
  198. if upper(right(IFFBaseName,4))=".PIC" then ext=".PIC"
  199. if upper(right(IFFBaseName,4))=".PXR" then ext=".PXR"
  200. if upper(right(IFFBaseName,4))=".6RN" then ext=".6RN"
  201. if upper(right(IFFBaseName,4))=".RGB" then ext=".RGB"
  202. if upper(right(IFFBaseName,4))=".PIC" then ext=".PIC"
  203. if upper(right(IFFBaseName,4))=".SUN" then ext=".SUN"
  204. if upper(right(IFFBaseName,4))=".TIF" then ext=".TIF"
  205. if upper(right(IFFBaseName,4))=".TGA" then ext=".TGA"
  206. if upper(right(IFFBaseName,4))=".VTI" then ext=".VTI"
  207. if upper(right(IFFBaseName,4))=".RLA" then ext=".RLA"
  208. if upper(right(IFFBaseName,4))=".XWD" then ext=".XWD"
  209. if upper(right(IFFBaseName,4))=".YUV" then ext=".YUV"
  210.  
  211. return ext
  212.  
  213.